home *** CD-ROM | disk | FTP | other *** search
- Path: news.iastate.edu!deaven
- From: deaven@ishmael.ameslab.gov (David Deaven)
- Newsgroups: comp.sys.cbm,gnu.gcc.help,de.comp.gnu,comp.sys.atari.8bit
- Subject: Re: GNU C-compiler port to 6502
- Date: 29 Mar 1996 23:20:47 GMT
- Organization: Ames Laboratory, Ames, Iowa
- Message-ID: <4jhr8f$hum@news.iastate.edu>
- References: <gnusenet199603252155.NAA11650@netcom9.netcom.com> <4je9c0$idd@esel.cosy.sbg.ac.at>
- NNTP-Posting-Host: ishmael.ameslab.gov
-
- In article <4je9c0$idd@esel.cosy.sbg.ac.at>,
- Gerhard Wesp <gwesp@cosy.sbg.ac.at> wrote:
- >Here goes the complete example:
- >Let test.c be:
- >
- >char *p;
- >foo()
- >{
- > while(*p);
- >}
- >
-
- Just for completeness, here's what you get if you use CC65 (the Atari C
- compiler) on this example code:
- ------------------
- _p:
- .blkb 2
- _foo:
- jsr enterfun
- L2:
- lda _p
- ldx _p+1
- jsr ldai
- jsr tstax
- lbeq L3
- jmp L2
- L3:
- jmp exitfun
- .globl _foo
- .globl _p
- ------------------
-
- Note the two subroutine calls required for each bit test. This might be
- the lesser of two evils in a 6502 C compiler. Gerhard had reported on
- the results using the "Oric" compiler (I never heard of that one
- before) which has other problems:
-
- >_foo
- >Ltest1
- >Ltest2
- > ldx _p
- > lda _p+1
- > stx tmp
- > sta tmp+1
- > ldy #0
- > lda (tmp),y
- > sta tmp0
- >
- > lda #0
- > ldx tmp0
- > stx tmp0
- > bpl *+4
- > lda #$FF
- > sta tmp0+1
- >
- > lda tmp0
- > ora tmp0+1
- > beq *+5
- > jmp Ltest1
- >
- > rts
- >
- >_p
- > RESERVE 2
- >
- >
- >Note that this is the ORIC C-compiler found at
- >http://www.dcs.ed.ac.uk/~axc/FLOOR1/oric.html#compiler
- >(this is derived from lcc) and _not_ the ATARI cc65 from umich.edu.
- >(Just the executable names coincide).
-
- --
- David Deaven deaven@ishmael.ameslab.gov
- A504 Physics tel 515-294-6878
- Ames Laboratory fax 515-294-0689
- Ames IA 50011 http://www.public.iastate.edu/~deaven
-